package api

import (
	"autoclave/model"
	"github.com/gin-gonic/gin"
)

type DemoController struct {
}

func (con DemoController) Test(ctx *gin.Context) {

	data := model.Equip{}
	err := model.DB.Where("id = 1").Find(&data).Error
	if err != nil {
		ctx.JSON(200, gin.H{
			"code":    1,
			"message": "sql error!",
			"data":    err.Error(),
		})
		return
	}
	ctx.JSON(200, gin.H{
		"code":    0,
		"message": "success",
		"data":    data,
	})
}
